package com.cdxy.util;

/**
 * @Author: tangy
 * @Date: 2020/3/7 18:32
 */
public class EnvironmentUtil {
    public EnvironmentUtil() {
    }

    public static String getEnvFlag() {
        return PropertiesUtil.getEnvironment().getActiveProfiles()[0];
    }

    public static boolean isPrd() {
        return "prd".equalsIgnoreCase(getEnvFlag());
    }

    public static boolean isPre() {
        return "pre".equalsIgnoreCase(getEnvFlag());
    }

    public static boolean isTest() {
        return "test".equalsIgnoreCase(getEnvFlag());
    }

    public static boolean isDev() {
        return "dev".equalsIgnoreCase(getEnvFlag());
    }

    public static boolean isLoc() {
        return "loc".equalsIgnoreCase(getEnvFlag());
    }

    public static boolean isSandbox() {
        return "sandbox".equalsIgnoreCase(getEnvFlag());
    }

    public static boolean isNotPrdPre() {
        return !isPrd() && !isPre();
    }

    public static boolean isLocOrDev() {
        return isLoc() || isDev();
    }
}
